package com.zhuoshi.serviceImpl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.zhuoshi.entity.Client;
import com.zhuoshi.mapper.ClientMapper;
import com.zhuoshi.service.ClientService;

/**
 * 
 * @author 海生
 *
 */

@Service
@Transactional
public class ClientServiceImpl implements ClientService {

	@Autowired
	private ClientMapper clientMapper;
	//查询所有客户基本信息
	public List<Client> selectClientAllLu() throws Exception {		
		return clientMapper.selectClientAllLu();
	}
	
	//添加客户基本信息
	public int addClientLu(Client client) throws Exception {
		return clientMapper.addClientLu(client);
	}

	//删除客户信息
	public int deleteClient(int id) throws Exception {
		return clientMapper.deleteByClientidLu(id);
	}

	//根据id查询
	public Client selectClient(int id) throws Exception {
		return clientMapper.selectByPrimaryKey(id);
	}

	//修改客户信息
	public int updateClient(Client client) throws Exception {
		return clientMapper.updateClient(client);
	}

	//模糊查询客户信息
	public List<Client> mohuSelectClient(Client client) throws Exception {
		List<Client> clientList = clientMapper.mohuSelectClient(client);
		return clientList;
	}

	//根据电话查询客户ID和名称
	public Client selectClientIdAndNameByPhone(String phone) {
		Client client= clientMapper.selectClientIdAndNameByPhone(phone);
		return client;
	}

}

